/*package com.wsjc.web.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wsjc.common.core.entity.ApiCommonResultVo;
import com.wsjc.common.core.utils.EncryptUtil;
import com.wsjc.common.core.utils.RandomUtils;
import com.wsjc.web.controller.common.BaseController;


*//**
 * 登录的接口api
 *//*
@Controller
@Scope("prototype")
@RequestMapping("app/")
public class LoginController extends BaseController {

	

	private static final Logger LOG = LoggerFactory.getLogger(LoginController.class);
	
	*//**
	 * 登录
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 *//*
	@RequestMapping(value = "login", method = { RequestMethod.POST, RequestMethod.GET })
	@ResponseBody
	public ApiCommonResultVo login(HttpServletRequest request, ModelMap model, @RequestParam("mobile") String mobile,
			@RequestParam("password") String password) throws Exception {
		
		Map<String, Object> result = new HashMap<>();
		RpUserInfo userInfo = rpUserInfoService.userLogin(mobile, password);
		RpMerchant merchant = rpMerchantService.getDataByMerchentNo(userInfo.getUserNo()) ;
		if(merchant == null){
			merchant = new RpMerchant();
			merchant.setStatus(WsMerchantStatusEnum.NOCREATED.name());
		}
		
		result.put("rpMerchant", merchant);
		result.put("rpUserInfo", userInfo);
		return new ApiCommonResultVo(result);
	}
	
	
	*//**
	 * 手机验证码登�?
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 *//*
	@RequestMapping(value = "mobileLogin", method = { RequestMethod.POST, RequestMethod.GET })
	@ResponseBody
	public ApiCommonResultVo mobileLogin(HttpServletRequest request, ModelMap model, @RequestParam("mobile") String mobile,
			@RequestParam("code") String code) throws Exception {
//		RpUserInfo userInfo = rpUserInfoService.mobileLogin(mobile, code);
		
		return new ApiCommonResultVo(userInfo);
	}
	
	*//**
	 * 注册
	 * @param request
	 * @param mobile 注册手机�?
	 * @param password 密码
	 * @param verification 验证�?
	 * @param invite �?请码
	 * @return
	 * @throws Exception
	 *//*
	@RequestMapping(value = "register", method = { RequestMethod.POST, RequestMethod.GET })
	@ResponseBody
	public ApiCommonResultVo register(HttpServletRequest request, ModelMap model, @RequestParam("mobile") String mobile,
			@RequestParam("password") String password,@RequestParam("verification") String verification,@RequestParam("invite") String invite) throws Exception {
		String regex = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$";
		if(!password.matches(regex)){
			return new ApiCommonResultVo(-2, "请输�?6-20位数字和字母组合的密�?", "");
		}
		
		RpUserInfo rpUserInfo = rpUserInfoService.getDataByMobile(mobile);
		if(rpUserInfo != null){
			return new ApiCommonResultVo(-2, "用户已存�?", "");
		}
		
		RpUserInfo userInfo = rpUserInfoService.registerForApp(mobile, password, verification, invite);
		
		return new ApiCommonResultVo(userInfo);
	}
	
	*//**
	 * 发�?�验证码
	 * @param request
	 * @param mobile 手机
	 * @return
	 * @throws Exception
	 *//*
	@RequestMapping(value = "sendSMS", method = { RequestMethod.POST, RequestMethod.GET })
	@ResponseBody
	public ApiCommonResultVo sendSMS(HttpServletRequest request, ModelMap model, @RequestParam("mobile") String mobile) throws Exception {
		
		String code = RandomUtils.randomInt(6);
		
		// 阿里大鱼
		SmsCodePo po = smsCodeService.insert(mobile, code);
		
		if(StringUtils.isEmpty(mobile)){
			return new ApiCommonResultVo(-2,"请输入手机号","");
		}
		if(po.getSuccess().equals("true")){
			return new ApiCommonResultVo(0,"发�?�成�?","");
		}else{
			return new ApiCommonResultVo(-2,"发�?�失�?","");
		}
		
		
		// 阿里�?
		SmsCodePo smsCode = smsCodeService.insertForAliyun(mobile, code);
		if ("true".equals(smsCode.getSuccess())) {
			return new ApiCommonResultVo(0,"发�?�成�?","");
		} else {
			return new ApiCommonResultVo(-2,"发�?�失�?","");
		}
		
	}
	
	*//**
	 * 忘记(修改密码)
	 * @param request
	 * @param model
	 * @return
	 * @throws Exception
	 *//*
	@RequestMapping(value = "editPwd", method = { RequestMethod.POST, RequestMethod.GET })
	@ResponseBody
	public ApiCommonResultVo editPwd(HttpServletRequest request, @RequestParam(value = "mobileNo") String mobileNo, @RequestParam("verification") String verification,
			@RequestParam(value = "password") String password) throws Exception {
		RpUserInfo rpUserInfo = rpUserInfoService.getDataByMobile(mobileNo);
		if(rpUserInfo == null){
			return new ApiCommonResultVo(-2, "用户不存�?", "");
		}
		String regex = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$";
		if(!password.matches(regex)){
			return new ApiCommonResultVo(-2, "请输�?6-20位数字和字母组合的密�?", "");
		}
		
		if(!rpUserInfo.getMobile().equals(mobileNo)){
			return new ApiCommonResultVo(-2, "手机号不匹配", "");
		}
		
		SmsCodePo codePo = smsCodeService.selectOne(mobileNo);
		if(codePo == null || !codePo.getCode().equals(verification)){
			LOG.info("code:"+codePo.getCode());
			throw UserBizException.USER_MOBILE_CODE_ERROR;
		}
		
		rpUserInfo.setPassword(EncryptUtil.encodeMD5String(password,rpUserInfo.getUserNo()));
		rpUserInfoService.updateData(rpUserInfo);
		return new ApiCommonResultVo(rpUserInfo);
	}
    
}
*/